home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 424_02 / ED-157 / new_window.c < prev    next >
C/C++ Source or Header  |  1993-09-10  |  2KB  |  48 lines

  1. /*
  2.  * Copyright (C) 1992 by Rush Record (rhr@clio.rice.edu)
  3.  * 
  4.  * This file is part of ED.
  5.  * 
  6.  * ED is free software; you can redistribute it and/or modify it under the terms
  7.  * of the GNU General Public License as published by the Free Software Foundation.
  8.  * 
  9.  * ED is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  10.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  11.  * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  12.  * 
  13.  * You should have received a copy of the GNU General Public License along with ED
  14.  * (see the file COPYING).  If not, write to the Free Software Foundation, 675
  15.  * Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17. #include "opsys.h"
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22.  
  23. #include "rec.h"
  24. #include "window.h"
  25. #include "ed_dec.h"
  26.  
  27. /******************************************************************************\
  28. |Routine: new_window
  29. |Callby: edit
  30. |Purpose: Allocates a new window in the window database. Returns 1 for success,
  31. |         0 if no more window slots are available.
  32. |Arguments:
  33. |    fname is the name of the file associated with the window.
  34. \******************************************************************************/
  35. Int new_window(fname)
  36. Char *fname;
  37. {
  38.     if(NWINDOWS >= MAX_WINDOWS - 1)
  39.         return(-1);    /* no window available */
  40.     WINDOW[NWINDOWS].base = BASE;
  41.     WINDOW[NWINDOWS].modified = 0;
  42.     save_window();
  43.     WINDOW[NWINDOWS].filename = (Char *)imalloc(strlen(fname) + 1);
  44.     strcpy(WINDOW[NWINDOWS].filename,fname);
  45.     return(NWINDOWS++);
  46. }
  47.  
  48.